package com.goverse.mancraft.man.action;

import android.util.Log;

import static com.goverse.mancraft.CommonParams.MAKE_MONEY_PER_SEC;

/**
 * Created by gaoyu on 2017/4/15.
 */

public class WorkAction extends AbstractAction {

    private Runnable mMakeMoneyThread = new Runnable() {
        @Override
        public void run() {
            mMan.addMoney(MAKE_MONEY_PER_SEC);
            mHandler.postDelayed(this, 1000);
        }
    };

    @Override
    public int getLoseHp() {
        return 3;
    }

    @Override
    public void onStop() {
        mHandler.removeCallbacks(mMakeMoneyThread);
    }

    @Override
    public void onStart() {
        mMan.addMoney(MAKE_MONEY_PER_SEC);
        Log.d("ManCraft", "~~~Work~~~Starting~~~");
        mHandler.postDelayed(mMakeMoneyThread, 1000);
    }
}
